<!--

  会员充值记录列表页面， 数据渲染 
   业务： 会员充值记录

  @author terrfly
  @site https://www.jeequan.com
  @date 2022/11/30 07:07
-->
<template>
	<view class="card">
		<view class="card-content" @tap="toDetails">
			<view class="card-content-title">
				<view class="card-content-title-left">
					<image :src="props.record.avatarUrl" />
					<text>{{ props.record.mbrName }}</text>
				</view>
				<view class="card-content-title-right">
					<text>￥</text>
					<text>{{ cal.cert2Dollar(props.record.entryAmount) }}</text>
				</view>
			</view>
			<view class="card-content-line"></view>
			<view class="card-content-body">
				<view class="card-content-body-row">
					<text>充值时间</text>
					<text>{{ props.record.createdAt }}</text>
				</view>
				<view class="card-content-body-row">
					<text>充值状态</text>
					<view class="order">
						<view class="order-spot" :style="{ backgroundColor: datamap.rechargeRecordImage(props.record.state).color }"></view>
						<text class="order-text">{{ datamap.rechargeRecordImage(props.record.state).text }}</text>
					</view>
				</view>
				<view v-if="props.record.state==2" class="card-content-body-row">
					<text>充值后余额</text>
					<text>￥{{ cal.cert2Dollar(props.record.afterBalance) }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { reactive, ref } from 'vue'
import cal from '@/commons/utils/cal.js'
import go from '@/commons/utils/go.js'
import datamap from '@/commons/utils/datamap.js'


// 定义传入属性
const props = defineProps({
  record: { type: Object, default: () => {} }, // 渲染对象
})

//前往会员详情
const toDetails = () => {
	go.to('PAGES_MEMBER_RECHARGE_RECORD_DETAIL', { rechargeRecordId: props.record.rechargeRecordId })
}

</script>

<style lang="scss" scoped>
	.card {
		width: 690rpx;
		
		margin: 30rpx auto;
	}
	.card-content {
		border-radius: 20rpx;
		background-color: $J-bg-ff;
		margin: 10rpx 0;
	}
	
	.card-content-title {
		height: 100rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding: 0 30rpx;
		
		.card-content-title-left {
			height: 100rpx;
			display: flex;
			color: #000000ff;
			font-size: 30rpx;
			flex-direction: row;
			align-items: center;
			
			image {
				width: 40rpx;
				height: 40rpx;
				border-radius: 50%;
			}
			text {
				padding-left: 10rpx;
			}
		}
		.card-content-title-right {
			font-weight: 600;
			color: #000000ff;
			
			text:first-child {
				font-size: 20rpx;
			}
			text:last-child {
				font-size: 30rpx;
			}
		}
	}
	
	.card-content-line {
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.06);
	}
	
	.card-content-body {
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: space-evenly;
		box-sizing: border-box;
		
		.card-content-body-row {
			display: flex;
			flex-direction: row;
            align-items: center;
			justify-content: flex-start;
			opacity: 1;
			padding-left: 50rpx;
			height: 60rpx;
			text:first-child {
				width: 160rpx;
				color: #999999ff;
				font-size: 26rpx;
				font-weight: 400;
			}
			text:last-child {
				color: #000000ff;
				font-size: 26rpx;
				font-weight: 400;
			}
			
			.order {
				display: flex;
				flex-direction: row;
				align-items: center;
				
				.order-spot {
					width: 10rpx;
					height: 10rpx;
					border-radius: 50%;
				}
				.order-text {
					padding-left: 10rpx;
					color: #000000ff;
					font-size: 26rpx;
					font-weight: 400;
				}
			}
		}
	}
</style>
